import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/components/index/Index'

// 公共区域
// import CommonHeader from '@/components/header/CommonHeader';
import SimpleHeader from '@/components/header/SimpleHeader/SimpleHeader'
import CommonFooter from '@/components/footer/CommonFooter'

// 首页
import HomeContent from '@/components/content/HomeContent'
import LoginContent from '@/components/content/LoginContent'
import ProblemContent from "@/components/content/ProblemContent";

Vue.use(Router)

export default new Router({
    // mode: 'history',
    base: __dirname,
    scrollBehavior: () => ({ y: 0 }),
    routes: [{
        path: '/',
        name: 'Home',
        redirect: "home",
        component: Index,
        children: [
          // 登录页
          {
            path: '/login',
            name: 'login',
            components: {
              header: SimpleHeader,
              content: LoginContent,
              footer: CommonFooter
            }
          },
          // 题库
          {
            path: '/',
            name: 'home',
            components: {
              header: SimpleHeader,
              content: HomeContent,
              footer: CommonFooter
            }
          },
          // 题目详情
          {
            path: '/problem',
            name: 'problem',
            components: {
              header: SimpleHeader,
              content: ProblemContent,
              footer: CommonFooter
            }
          },
          // 提交记录
          {
            path: '/commit',
            name: 'commit',
            components: {
              header: SimpleHeader,
              content: ProblemContent,
              footer: CommonFooter
            }
          },
        ]
    }]
})
